<template>
	<view class="rticleaInfo">
		<block v-if="rticleaData.adminName">
			<swiper-list :swiperList="rticleaData.rticleaImgList" dataType="v"></swiper-list>
			<view class="container">
				<view class="tui-news-title">
					{{rticleaData.rticleaTitle}}
				</view>
				<view class="tui-sub-info">
					<view class="tui-sub-left">
						<text class="tui-author">{{rticleaData.adminName}}</text>
						<text>{{rticleaData.rticleaTime}}</text>
					</view>
					<view class="tui-sub-right">阅读 {{rticleaData.rticleaRead}}</view>
				</view>
				<view class="tui-news-content">
					<view class="tui-article">
						{{rticleaData.rticleaComm}}
					</view>
				</view>
				<view class="tui-news-source">文章分类：{{rticleaData.rticleaType}}</view>
			</view>
		</block>
	</view>
</template>

<script>
	import swiperList from '../../components/swiperList.vue'
	export default {
		components: {
			swiperList
		},
		data() {
			return {
				rticleaId: 1,
				rticleaData: {}
			};
		},
		onLoad(option) {
			this.rticleaId = option.rticleaId || 1
			this.getRticleaById()
		},
		methods: {
			getRticleaById() {
				this.$api.getRticleaById({
					rticleaId: this.rticleaId
				}).then(res => {
					if (res.code) {
						this.rticleaData = res.data
						uni.$emit('updataRticleaRead', this.rticleaId, this.rticleaData.rticleaRead)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.rticleaInfo {
		min-height: 100vh;
		background-color: #FFFFFF;

		.container {
			padding: 40rpx 30rpx 110rpx 30rpx;
			box-sizing: border-box;
		}

		.tui-news-title {
			font-size: 48rpx;
			font-weight: 500;
			text-align: justify;
		}

		.tui-sub-info {
			padding-top: 30rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			color: #999;
		}

		.tui-news-content {
			padding-top: 40rpx;
		}

		.tui-article {
			/* text-indent: 2em; */
			font-size: 34rpx;
			padding-bottom: 40rpx;
			line-height: 60rpx;
			text-align: justify;
			word-break: break-all;
			word-wrap: break-word;
		}

		.tui-news-source {
			font-size: 24rpx;
			color: #999;
		}

		.tui-article-pic {
			width: 100%;
			display: block;
			margin-bottom: 40rpx;
		}


		.tui-author {
			color: #5677fc;
			padding-right: 20rpx;
		}
	}
</style>
